#include <REGX52.H>
#include "timer.h"
#include "delay.h"
unsigned char counter,compare;
void main(){
	unsigned char i;
	Timer0Init();
	while(1){
		for(i=0;i<100;i++){
			compare=i;
			Delay1ms(10);
		}
		for(i=100;i>0;i--){
			compare=i;
			Delay1ms(10);
		}
}
}
void Int0_Timer(void)  interrupt 1{
	TL0 = 0xa4;		//设置定时初值
	TH0 = 0xFf;
	counter++;
	counter%=100;
	if(counter<compare){
		P2_0=0;
	}
	else{
		P2_0=1;
	}
}
